package com.mike.spring.CustomTag;

import com.mike.spring.CustomTag.Bean.AClass;
import com.mike.spring.IOC.HongKongNewsProvider;
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
import org.springframework.beans.factory.xml.XmlBeanFactory;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.context.support.FileSystemXmlApplicationContext;
import org.springframework.core.io.ClassPathResource;
import org.springframework.web.context.support.XmlWebApplicationContext;

public class MainClass {
    public static void main(String[] args) {
//        ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("classpath:/com/mike/spring/CustomTag/beans.xml");
//        ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("/com/mike/spring/CustomTag/beans.xml");
//        ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("file:/Users/will/git/knowledge/系统学习/spring系统学习/spring/src/main/resources/com/mike/spring/CustomTag/beans.xml");
//        FileSystemXmlApplicationContext context = new FileSystemXmlApplicationContext("/com/mike/spring/CustomTag/beans.xml");
//        XmlWebApplicationContext context = new XmlWebApplicationContext();
//        context.setConfigLocation("classpath:/com/mike/spring/CustomTag/beans.xml");
//        context.refresh();
        DefaultListableBeanFactory beanFactory3 = new DefaultListableBeanFactory();
        XmlBeanDefinitionReader beanDefinitionReader = new XmlBeanDefinitionReader(beanFactory3);
        beanDefinitionReader.loadBeanDefinitions(new ClassPathResource("/com/mike/spring/CustomTag/beans.xml"));
        AClass aClass = (AClass) beanFactory3.getBean("parse");
        System.out.println("args = [" + aClass.getName() + "]");
    }
}
